<template>
  <div class="measurement">
    <img src="../../../assets/chart-data-bg.png" />
    <div class="title">
      <div class="title-left">
        <span>施工监控量测工作进展</span>
        <img src="../../../assets/show-title-bg.png" />
      </div>
    
    </div>

    <div class="measurement-status">
      <div class="measurement-status-item">
        <span>{{monitorMeasurementNumber}}</span>
        <span>拱顶下沉</span>
      </div>
      <div class="measurement-status-item">
        <span>{{monitorFootNumber}}</span>
        <span>拱脚下沉</span>
      </div>
      <div class="measurement-status-item">
        <span>{{monitorReportNumber}}</span>
        <span>周边位移</span>
      </div>
      <div class="measurement-status-item">
        <span>{{monitorSurfaceNumber}}</span>
        <span>地表下沉</span>
      </div>
    </div>

    <div class="measurement-data">
      <div :style="{ zoom: zoom }" id="measurement" class="measurement-data-view">
        <!-- 这里渲染了图表 -->
      </div>
    </div>
  </div>
</template>

<script>
import api from "../../../api";
import * as echarts from "echarts";
export default {
  name: "",
  components: {},
  data() {
    return {
      zoom: 1,
      myChart: {},
      monitorFootNumber: 0,
      monitorMeasurementNumber: 0,
      monitorReportNumber: 0,
      monitorSurfaceNumber: 0,
    };
  },
  mounted() {
    this.$bus.$on("early-warning", (row) => {
      api
        .bigdatagetMonitoringmeasurement({ tid: row })
        .then((res) => {
          if (res.data.code == 2001) {
            this.monitorFootNumber = res.data.data.monitorFootNumber;
            this.monitorMeasurementNumber =
              res.data.data.monitorMeasurementNumber;
            this.monitorReportNumber = res.data.data.monitorReportNumber;
            this.monitorSurfaceNumber = res.data.data.monitorSurfaceNumber;
          }
        })
        .catch((err) => {
          console.log(err);
        });
      api
        .bigdatagetMonitoringmeasurementjindu({ tid: row })
        .then((res) => {
          if (res.data.code == 2001) {
            this.$charts.construction("measurement", res.data.data);
          }
        })
        .catch((err) => {
          console.log(err);
        });
    });
  },
  methods: {},
};
</script>

<style lang="scss" scoped>
.measurement {
  width: 100%;
  height: 35%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;

  > img {
    width: 100%;
    position: absolute;
    left: 0;
    bottom: 0;
  }

  > .title {
    width: 100%;
    height: 43px;
    padding-right: 30px;
    position: relative;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;

    > span {
      color: #cecece;
      font-size: 18px;
    }

    > .title-left {
      flex: 1;
      height: 43px;
      display: flex;
      align-items: center;
      padding-left: 60px;
      position: relative;
      > img {
        width: 218px;
        height: 43px;
        position: absolute;
        left: 0;
        top: 0;
      }

      > span {
        position: relative;
        color: #fff;
        font-size: 18px;
      }
    }
  }

  .measurement-status {
    width: 100%;
    height: 60px;
    display: flex;
    justify-content: space-around;
    box-sizing: border-box;

    > .measurement-status-item {
      width: 100px;
      height: 100%;
      display: flex;
      justify-content: flex-end;
      align-items: center;
      flex-direction: column;
      box-sizing: border-box;

      > span:nth-child(1) {
        font-size: 25px;
        font-weight: bold;
        color: #EB4E4F;
      }

      > span:nth-child(2) {
        color: #fff;
        font-size: 19px;
      }
    }
  }

  > .percentage {
    width: 100%;
    height: 53px;
    margin-top: 20px;
    padding-left: 20px;
    padding-right: 40px;
    box-sizing: border-box;
    display: flex;
    position: relative;
    justify-content: space-between;
    align-items: center;

    > i {
      width: 10px;
      height: 100%;
      display: block;
      background-color: #ee8542;
      position: absolute;
      left: 0;
      top: 0;
    }

    > img {
      width: 219px;
      height: 53px;
      position: absolute;
      left: 10px;
      top: 0;
    }

    > span {
      position: relative;
      z-index: 99;
    }

    > span:nth-child(1) {
      font-size: 18px;
      color: #fff;
    }

    > span:nth-child(2) {
      font-size: 26px;
      color: #ff8b3e;
      font-weight: 700;
    }
  }

  > .measurement-data {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    box-sizing: border-box;
    margin-top: -30px;

    .measurement-data-view {
      width: 100%;
      height: 100%;
    }
  }
}
</style>
